const { createApp, ref } = Vue
const app = createApp({
    data() {
        return {
            lotteryArr: [['1币', '3币', '5币'], ['15币', 'Go', '7币'], ['13币', '11币', '9币']],
            currIndex: '1币',
            order: ['1币', '3币', '5币', '7币', '9币', '11币', '13币', '15币'],
            luckyNum: null,
            today: (new Date().getDay() + new Date().getDate()) % 6,
            showPlus: false

        }
    },
    methods: {
        go(subItem) {
            console.log(this.today, this.luckyNum % 9)
            if (subItem === 'Go') {
                if (this.luckyNum === null) {
                    alert('请输入今日幸运数字')
                    return
                }
                let flag = 0
                const dynamicInerval = (this.luckyNum % 9 + 1) * 50
                const startGo = setInterval(() => {
                    flag = (flag + 1) % 8
                    this.currIndex = this.order[flag]
                }, dynamicInerval)
                setTimeout(() => {
                    clearInterval(startGo)
                    this.showPlus = true
                }, (this.today + 1) * 3000);
            }
        }
    },
})
app.mount("#app")